package com.jiang.Controller;

import com.jiang.Service.Userserviceimpl;
import com.jiang.pojo.User;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @author jiangjingbo
 * @version V1.0
 * @Project java2203
 * @Package com.jiang.Controller
 * @Description:
 * @Date 2022/6/9 17:20
 */
@Controller
@RequestMapping("/user")
public class UserALL {
    @Autowired
    private Userserviceimpl userserviceimpl;

//    获取记录器
    Logger logger=Logger.getLogger(UserALL.class);
    @RequestMapping("test1")
    public  String test1(Model model, HttpSession session){
        ////日志中的数据需要收集, 供大数据分析使用, 那么可以正常打印info信息
        logger.info("======ingo=====");
        //一把在try cath中异常打印error
        logger.error("======error======");
        //可以在开发阶段使用打印
        logger.debug("====debug======");


        List<User> users = userserviceimpl.FindUserALL();
//        session.setAttribute("users",users);
        model.addAttribute("users",users);
        return "user";
    }

}
